/**
 * @author homepagecn@gmail.com
 * @version $Id: user.js 13 2011-11-30 09:54:29Z homepagecn@gmail.com $
 */
var sessions = {};
exports.join = function(uid, nick){
    if(typeof(sessions[uid]) == 'undefined'){
        var session = {
            uid : uid,
            nick : nick,
            timestamp : (new Date()).getTime(),
            room : [],
            poke : function(){
                session.timestamp = (new Date()).getTime()
            },
            destroy : function(){
                delete sessions[session.uid];
            }
        }
        sessions[uid] = session;
    }else{
        var session = sessions[uid];
    }
    return session;
}
exports.getInfo = function(uid){
    if(typeof(sessions[uid]) == 'undefined'){
        return false;
    }else{
        return sessions[uid];
    }
}